using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Threading;
using B4ALL.Common;

namespace B4ALL.Cache
{
    public class CacheContext : IContext
    {

        public String CONTEXT_NAME
        {
            get
            {
                return "CacheContext";
            }
        }

        private Boolean _enabled = true;

        public Boolean Enabled
        {
            get { return _enabled; }
            set { _enabled = value; }
        }


        private Boolean? _refresh = null;

        public Boolean? Refresh
        {
            get { return _refresh; }
            set { _refresh = value; }
        }


        private Int32? _duration = null;
        public Int32? Duration
        {
            get { return _duration ; }
            set { _duration = value; }
        }

        public CacheContext()
        {
        }

        public CacheContext(Boolean enabled)
        {
            _enabled = enabled;
        }

        public CacheContext(Boolean enabled, Boolean refresh)
        {
            _enabled = enabled;
            _refresh = refresh;
        }

        public CacheContext(Boolean enabled, Boolean refresh, Int32 duration)
        {
            _enabled = enabled;
            _refresh = refresh;
            _duration= duration;

        }
    }

    public class ContextFactory
    {

        public static CacheContext GetContext(Boolean enabled, Boolean refresh, Int32 duration)
        {
            return new CacheContext(enabled, refresh, duration);
        }

        public static CacheContext GetContext()
        {
            return new CacheContext(true);
        }

    }

}
